			var mobileDemo = {
				'center' : '57.7973333,12.0502107',
				'zoom' : 10
			};
			
			var ways = [
			            		{name: "s1", location: 'Ägyptisches Museum, München'},
			            		{name: "s2", location: 'Alte Pinakothek, München'},
			            		{name: "s3", location: 'Neue Pinakothek, München'},
			            		{name: "s4", location: 'Brandhorst Museum, München'},
			            		{name: "s5", location: 'Glyptothek, München'},
			            		{name: "s6", location: 'Pinakothek der Moderne, München'},
			            		{name: "s7", location: 'Bayerisches Nationalmuseum, München'},
			            		{name: "s8", location: 'Deutsches Museum, München'}
			];
			var  locationMarker = new  google.maps.MarkerImage('/CityGuide/img/icons/star-3.png',
		                    	  new google.maps.Size(32,37),
		                     	  new google.maps.Point(0,0),
		                     	  new google.maps.Point(19,35));
		
			////////////////////////////////////////////////////////////
			
			function lets(pos){
				 var map = $('#map_canvas').gmap({
						'center' : mobileDemo.center,
						'zoom' : mobileDemo.zoom,
						'disableDefaultUI' : true,
						'callback' : function(map) {
							var self = this;
							
							var waypts = [];

			                for (var i in ways) {
			                    waypts.push({
			                        location: ways[i].location,
			                        stopover:true
			                    });
			                }

							self.displayDirections({ 'origin': pos.coords.latitude + ',' + pos.coords.longitude, 
													 'destination': pos.coords.latitude + ',' + pos.coords.longitude,
													  'waypoints': waypts,
													  'optimizeWaypoints': true,
													 'travelMode': google.maps.DirectionsTravelMode.WALKING }, 
													 { 'panel': document.getElementById('directions'), 'suppressMarkers':true}, function(response, status) {
								//( status === 'OK' ) ? $('#results').show() : console.log("ERROR ##########");
								//console.log("result: " , response.routes[ 0 ].legs[ 0 ]);
								var leg = response.routes[0].legs[0];
								
								self.addMarker({ 
									    'current': true,										
									    'icon': locationMarker,
										'position': new google.maps.LatLng(leg.start_location.lat(),leg.start_location.lng()), //lat lon
										'bounds': true
									}).click(function() {
													self.openInfoWindow({ 'content': "Ich" }, this);
									});

									self.find('markers', {'property': 'foo', 'value':'bar'}, function(marker, found){
										if(marker.current){
											marker.setAnimation(google.maps.Animation.BOUNCE);
										}
									});
									
									$.getJSON( '/CityGuide/data/museum.json', function(data) { 
										$.each( data.markers, function(i, marker) {
											//console.log(i, marker);
											var  interestMarker = new  google.maps.MarkerImage('/CityGuide/img/icons/loc-' + (i+1) + '.png',
				                    				new google.maps.Size(32,37),
				                     				new google.maps.Point(0,0),
				                     				new google.maps.Point(19,35)
				                 			);

											$('#map_canvas').gmap('addMarker', { 
												'icon': interestMarker,
												'position': new google.maps.LatLng(marker.latitude, marker.longitude), 
												'bounds': true
											}).click(function() {
												$('#map_canvas').gmap('openInfoWindow', { 'content': marker.content }, this);
											});
											
											
										});
									});
								});
							}
						});
				
				 $('body').removeClass('ui-loading');
			}

			$('#map_page').live('pageinit', function() {
				console.log("blub");
				$('body').addClass('ui-loading');
					
					var gl = null;
					try {
						  if(typeof(navigator.geolocation) == 'undefined'){
						    gl = google.gears.factory.create('beta.geolocation');
						    
						  } else {
							  $.mobile.showPageLoadingMsg('a','Lustig',false);
						    gl = navigator.geolocation;
						  }
						}catch(e){}
						 
						if (gl) {
							 gl.getCurrentPosition(function displayPosition(position) {
							 lets(position);
							},
							 
							function displayError(positionError) {
							  alert("error");
							});
						} else {  
						  alert("I'm sorry, but geolocation services are not supported by your browser.");  
						}
						
		
			});
			
			
			
		    
		    